<template>
    <div>
        <!-- 顶部 -->
        <div class="top">
            <div class="left" @click="router.back()"><img src="../../../public/Icon/返回.png" alt=""></div>
            <!-- 顶部中间 -->
            <div class="mid">
                <div @click="change1" :class="show1?'active':'act'">门店自提</div>
                <div @click="change2" :class="show2 ? 'active' : 'act'">送货上门</div>
            </div>
            <!-- 顶部右边 -->
            <div class="right">
                <div class="text">北京</div>
                <div class="img1"> <img class="img1" src="../../../public/Icon/下拉.png" alt=""></div>
            </div>
        </div>
        <!-- 门店 -->
        <div class="bot" v-for="(item, index) in lists" :key="index">
            <div>
                <div>{{ item.storeName }}</div>
                <div>{{ item.saturday }}</div>
                <div>{{ item.address }}</div>

            </div>
            <div>
                <div> 55m</div>
                <div @click="To(item)">查看详情></div>
            </div>
        </div>
    </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
import { getshopAddress } from '@/api/api'
import { onMounted, ref } from 'vue';
onMounted(() => {
    getAddress()
})
const lists = ref([])

const getAddress = async () => {
    let { list } = await getshopAddress()
    lists.value = list
}
const router = useRouter()
let show1 = ref(true)
let show2 = ref(false)
const change1 = () => {
    show1.value = true
    show2.value = false
}
const change2 = () => {
    show1.value = false
    show2.value = true

}
const To = (item) => {
    router.push({
        path: '/details',
        query: {
            items: JSON.stringify(item)
        }
    })
}
</script>

<style lang="scss" scoped>
.top {
    width: 100%;
    height: 50px;
    display: flex;
    justify-content: space-between;
    background-color: white;

    .left {
        width: 25px;
        height: 25px;
        margin: 10px;

        img {
            width: 25px;
            height: 25px;
        }
    }

    .mid {

        width: 320px;
        height: 50px;
        display: flex;

        div {
            text-align: center;
            margin-top: 10px;
            line-height: 30px;
            height: 30px;
            width: 120px;
            font-size: 14px;
            border-radius: 5px;
        }
    }

    .right {
        width: 60px;
        height: 25px;
        margin: 10px;
        display: flex;

        .text {
            width: 30px;
            height: 30px;
            line-height: 30px;
            font-size: 14px;
        }

        .img1 {
            width: 25px;
            height: 30px;
        }
    }

    .van-button {
        width: 81px;
        height: 30px;
        border-radius: 10%;
        font-size: 13px;
        color: #88afd5;
    }

}

.active {
    text-align: center;
    margin-top: 10px;
    line-height: 30px;
    height: 30px;
    width: 120px;
    font-size: 14px;
    border-radius: 5px;
    background-color: rgba(136, 175, 213, 1)
}

.act {
    text-align: center;
    margin-top: 10px;
    line-height: 30px;
    height: 30px;
    width: 120px;
    font-size: 14px;
    border-radius: 5px;
    background-color: aquam
}

.bot {
    width: 100%;
    height: 120px;
    margin-top: 20px;
    display: flex;
    justify-content: space-around;
    background-color: white;

    :nth-child(1) {
        width: 300px;
        height: 90px;

        :nth-child(1) {
            margin-left: 20px;
            height: 30px;
            font-size: 20px;
            margin-top: 10px;
        }

        :nth-child(2) {
            margin-left: 20px;
            height: 30px;
            font-size: 12px;
            margin-top: 5px;
        }

        :nth-child(3) {
            margin-left: 20px;
            height: 30px;
            font-size: 12px;
            margin-top: 5px;
        }

    }

    :nth-child(2) {
        width: 75px;
        height: 90px;

        :nth-child(1) {
            margin-top: 20px;
            width: 75px;
            height: 40px;
            font-size: 26px;
        }

        :nth-child(2) {
            color: rgba(85, 122, 157, 1);
            font-size: 14px;
            margin-top: 5px;
            width: 75px;
            height: 40px;
        }

    }
}
</style>